﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using BaseData.Common;
using BaseData.UI;
using TaxData.House;
using TaxEntity.House;
using TaxEntity.User;

namespace TaxBiz.House
{
    /// <summary>
    /// 承租人信息逻辑层
    /// </summary>
    public class RentInfoBiz
    {
        private RentInfoData rid = new RentInfoData();

        /// <summary>
        /// 获取承租人信息实体
        /// </summary>
        public RentInfoEntity GetEntityById(long ID)
        {
            RentInfoEntity model = rid.GetEntityById(ID);
            return model;
        }
        /// <summary>
        /// 获取承租人信息实体
        /// </summary>
        /// <param name="certificateID">房产证号</param>
        /// <param name="year">年份</param>
        /// <returns>承租人信息</returns>
        public RentInfoEntity GetEntityById(string certificateID, int year)
        {
            RentInfoEntity model = rid.GetEntityById(certificateID, year);
            return model;
        }

        /// <summary>
        /// 删除承租人
        /// </summary>
        public bool Delete(long ID, UserEntity optUser)
        {
            bool isSucc = rid.Delete(ID);
            return isSucc;
        }

        /// <summary>
        /// 获取承租人列表
        /// </summary>
        public DataTable GetList(string strWhere, int pageSize, int page, ref int allCount)
        {
            DataTable dt = rid.GetList(strWhere, pageSize, page, ref allCount);
            return dt;
        }

        /// <summary>
        /// 增加承租人
        /// </summary>
        /// <param name="model">承租人信息实体</param>
        /// <returns>成功承租人编号,失败返回0</returns>
        public long Add(RentInfoEntity model, UserEntity optUser)
        {
            long id = rid.Add(model);
            return id;
        }

        /// <summary>
        /// 修改承租人信息
        /// </summary>
        /// <param name="model">修改承租人</param>
        /// <returns>操作结果</returns>
        public bool Update(RentInfoEntity model, UserEntity optUser)
        {
            bool isSucc = rid.Update(model);
            return isSucc;
        }
    }
}
